Function Save-ISEOptionsAs
{
    [CmdletBinding()]
    Param(
        [Parameter(Mandatory = $False)]
        [String]
        $private:ISEOptionsText = $Null
    )
    
    Process
    {
        $private:Name = Read-Host "Please specify the name to save the ISE options as:"
        $private:ConfigXml = Get-ISEOptionsConfigXml
        
        If ([String]::IsNullOrEmpty($ISEOptionsText))
        {
            $private:ISEOptionsText = Get-VariableText "`$psISE.Options"
        }
        
        $private:XmlTextNode = $ConfigXml.CreateTextNode($ISEOptionsText)
        
        $private:ElementName = $Name -Replace "[\W]", "_"
        $private:XmlElement = $ConfigXml.CreateElement($ElementName)
        $XmlElement.SetAttribute("DisplayName", $Name)
        
        $XmlElement.AppendChild($XmlTextNode) | Out-Null
        $ConfigXml.ConfigManager.Menus.PowerShellISEOptions.AppendChild($XmlElement) | Out-Null
        
        $private:ConfigPath = Get-ProfilePath | Join-Path -ChildPath "ISEOptionsConfigurator.xml"
        $ConfigXml.Save($ConfigPath)
        
        Initialize-ISEOptionsConfigurator
        
        $private:ScriptBlock = $ExecutionContext.InvokeCommand.NewScriptBlock($ISEOptionsText)
        Invoke-Command $ScriptBlock | Out-Null
    }
}

Export-ModuleMember Save-ISEOptionsAs
